﻿layui.config({
    base: "Scripts/"
}).use(['form', 'layer', 'jquery', 'laypage'], function () {
    var form = layui.form,
		layer = parent.layer === undefined ? layui.layer : parent.layer,
		laypage = layui.laypage,
		$ = layui.jquery;


    //修改
    form.on('submit(Update)', function (data) {
        var Id = $("#ID").val();
        var Name = $("#Name").val();
        var Sex = $("#Sex").val();
        var Age = $("#Age").val();
        var Education = $("#Education").val();
        var AddTime = $("#AddTime").val();
        var Nation = $("#Nation").val();
        var IDNumber = $("#IDNumber").val();
        var Phone = $("#Phone").val();
        var Address = $("#Address").val();

     var that = this;
        $.ajax({
            type: "POST",
            url: "/Message/Compile",
            data: {
                "Id": Id,
                "Name": Name,
                "Sex": Sex,
                "Age": Age,
                "Nation": Nation,
                "Education": Education,
                "IDNumber": IDNumber,
                "Phone": Phone,
                "Address": Address,
                "AddTime": AddTime
            },
            dataType: "json",
            success: function (result) {

                var m = layer.msg(result.Message, { icon: 7, time: false, shade: 0.8 });
                layer.close(m);
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                layer.alert("修改失败 ！");
            }

        });

        layer.closeAll();
        return false;

    });

    //关闭
    $().ready(function () {
        $("#btnClose").click(function () {
            layer.closeAll();
        })
    });


});
